From 160ed4756b5c4be2b144f30b0e6ad221494cfdce Mon Sep 17 00:00:00 2001 From: "jfehlig@jfehlig2.provo.novell.com" Date: Wed, 13 Dec 2006 18:06:48 -0700 Subject: [PATCH] Fix VM.get_power_state API. On the xend side an integer representation of the power state was being returned instead of a string representation as specified by the XenAPI spec. On the c-bindings side the marshalling code converts the string representation to an enum value. A subsequent attempt to convert the enum from a string to an enum was causing a seg fault. Signed-off-by: Jim Fehlig --- tools/libxen/include/xen_internal.h | 1 - tools/libxen/src/xen_vm.c | 2 -- tools/python/xen/xend/XendAPI.py | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/libxen/include/xen_internal.h b/tools/libxen/include/xen_internal.h index 043c4053f8..324fb88428 100644 --- a/tools/libxen/include/xen_internal.h +++ b/tools/libxen/include/xen_internal.h @@ -128,7 +128,6 @@ xen_enum_lookup_(xen_session *session, const char *str, xen_enum_lookup_(session__, str__, lookup_table__, \ sizeof(lookup_table__) / \ sizeof(lookup_table__[0])) \ - \ #define XEN_ALLOC(type__) \ type__ * \ diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c index 1914b86959..9d96a0c233 100644 --- a/tools/libxen/src/xen_vm.c +++ b/tools/libxen/src/xen_vm.c @@ -324,9 +324,7 @@ xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result, xe }; abstract_type result_type = xen_vm_power_state_abstract_type_; - char *result_str = NULL; XEN_CALL_("VM.get_power_state"); - *result = xen_vm_power_state_from_string(session, result_str); return session->ok; } diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index 62b36a738b..c43ae75976 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -669,7 +669,7 @@ class XendAPI: # attributes (ro) def VM_get_power_state(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) - return xen_api_success(dom.state) + return xen_api_success(dom.get_power_state()) def VM_get_resident_on(self, session, vm_ref): return xen_api_success(XendNode.instance().uuid) -- 2.30.2